package com.xll.controller;

import com.xll.entity.Remark;
import com.xll.service.RemarkService;
import com.xll.utils.QueryInfo;
import com.xll.utils.Result;
import com.xll.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/remake")
public class RemarkController {

    @Autowired
    private RemarkService remarkService;



    @PostMapping("/inset")
    public Result findAllCell(@RequestParam("id") Long id,@RequestParam("value") Long value) {
        Remark remark = new Remark();
        remark.setCreateUser(SecurityUtils.getUsername());
        remark.setContent(value);
        remark.setScenicId(id);
        remarkService.insert(remark);
        return Result.success("添加成功");
    }

    @PostMapping("/findAll")
    public Result findAllCell(@RequestParam("id") Long id) {
        Result byScenicId = remarkService.findByScenicId(id);
        return byScenicId;
    }
}
